#include <iostream>
#include <Eigen/Dense>

using namespace Eigen;
using std::cout, std::endl;

void test_transpose(){
    Matrix3d m1 = (Matrix3d() << 1,2,3,4,5,6,7,8,9).finished();
    cout << "m1 = \n" << m1 << endl;
    cout << "m1.transpose() = \n" << m1.transpose() << endl << endl;;
    cout << "after .transpose(): m1 = \n" << m1 << endl << endl;
    // .transpose()之后，矩阵本身不会概念

    Matrix3d m2 = m1.transpose();
    cout << "m2 = \n" << m2 << endl << endl;
    cout << "m1 = \n" << m1 << endl << endl;
    m1 = m2;
    cout << "after = : m1 = \n" << m1 << endl << endl;

    // 问题代码
    Matrix3d m11 = (Matrix3d() << 1,2,3,4,5,6,7,8,9).finished();
    cout << "m11 = \n" << m11 << endl;
    m11 = m11.transpose().eval();
    cout << "after: m11 = \n" << m11 << endl;

}


int main(){
    test_transpose();
    return 0;
}